<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
    import {mapGetters,mapMutations} from 'vuex'

    export default {
      computed:{
          ...mapGetters([
            'token'
          ])
      },
    	created() {
    		if(this.token.access_token) {
            this.$http.defaults.headers.common.Authorization = 'Bearer ' + this.token.access_token
        }
        let config = window.websiteConfig
        for (let i in config) {
          config[i] = config[i] == 1
        }
        this.setWebsite(config)
        let contact = window.contact
        this.setContact(contact)
        let allow = window.resume == 1
        this.setResume({allow:allow,token:window.resumeToken})
        this.setUserSay(window.say)
        if(window.websiteSeo) {
          this.setWebsiteSeo(window.websiteSeo)
        }
    	},
      methods: {
        ...mapMutations({
            setWebsite: 'SET_WEBSITE',
            setContact: 'SET_CONTACT',
            setResume: 'SET_RESUME',
            setUserSay: 'SET_USER_SAY',
            setWebsiteSeo: 'SET_WEBSITE_SEO'
        })
      }
    }
</script>
